// ServletOutputStream.java - Implements javax.servlet.ServletOutputStream.
//
// Copyright (C) 1999-2002  Smart Software Consulting
// 
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
// 
// Smart Software Consulting
// 1688 Silverwood Court
// Danville, CA  94526-3079
// USA
// 
// http://www.smartsc.com
//

package com.smartsc.http;

import java.io.OutputStream;
import java.io.IOException;

public class
ServletOutputStream 
extends javax.servlet.ServletOutputStream
{
	protected
	ServletOutputStream( OutputStream os)
	{
		this.os = os;
	}
	
	// From java.io.OutputStream
	public void close() throws IOException { os.close(); }
	public void flush() throws IOException { os.flush(); }
	public void write(int b) throws IOException { os.write( b); }
	public void write(byte[] b) throws IOException { os.write( b); }
	public void write(byte[] b, int off, int len) throws IOException
	{
		os.write( b, off, len);
	}
	
	// From javax.servlet.ServletOutputStream
	public void print(char c) throws IOException
	{
		write( String.valueOf( c).getBytes());
	}
	public void print(double d) throws IOException
	{
		write( String.valueOf( d).getBytes());
	}
	public void print(float f) throws IOException
	{
		write( String.valueOf( f).getBytes());
	}
	public void print(int i) throws IOException
	{
		write( String.valueOf( i).getBytes());
	}
	public void print(long l) throws IOException
	{
		write( String.valueOf( l).getBytes());
	}
	public void print(String s) throws IOException
	{
		write( String.valueOf( s).getBytes());
	}
	public void print(boolean b) throws IOException
	{
		write( String.valueOf( b).getBytes());
	}

	public void println() throws IOException { write( CRLF); }
	public void println(char c) throws IOException
	{
		print( c); println();
	}
	public void println(double d) throws IOException
	{
		print( d);
	}
	public void println(float f) throws IOException
	{
		print( f); println();
	}
	public void println(int i) throws IOException
	{
		print( i); println();
	}
	public void println(long l) throws IOException
	{
		print( l); println();
	}
	public void println(String s) throws IOException
	{
		print( s); println();
	}
	public void println(boolean b) throws IOException
	{
		print( b); println();
	}
	
	private OutputStream os;
	
	private static final byte[] CRLF = { 0x0d, 0x0a };
}
